<!DOCTYPE html>
<html lang="zh_CN" class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>我的桌面</title>
    <header th:replace="header::html"></header>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <blockquote class="layui-elem-quote">欢迎：
                        <span class="x-red" id="show-nickName"></span><span id="show_date"></span>
                    </blockquote>
                </div>
            </div>
        </div>
        <div class="layui-col-md12" permission="sys:data:query">
            <div class="layui-card">
                <div class="layui-card-header">数据统计</div>
                <div class="layui-card-body ">
                    <ul class="layui-row layui-col-space10 layui-this x-admin-carousel x-admin-backlog" id="dataCount">

                    </ul>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">CPU</div>
                    <div class="layui-card-body ">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th>属性</th>
                                <th>值</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <th>核心数</th>
                                <td>[[${system.cpu.cpuNum}]]</td>
                            </tr>
                            <tr>
                                <th>用户使用率</th>
                                <td>[[${system.cpu.used}]]%</td>
                            </tr>
                            <tr>
                                <th>系统使用率</th>
                                <td>[[${system.cpu.sys}]]%</td>
                            </tr>
                            <tr>
                                <th>当前空闲率</th>
                                <td>[[${system.cpu.free}]]%</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">内存</div>
                    <div class="layui-card-body ">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th>属性</th>
                                <th>内存</th>
                                <th>JVM</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <th>总内存</th>
                                <td>[[${system.mem.total}]]G</td>
                                <td>[[${system.jvm.total}]]M</td>
                            </tr>
                            <tr>
                                <th>已用内存</th>
                                <td>[[${system.mem.used}]]G</td>
                                <td>[[${system.jvm.used}]]M</td>
                            </tr>
                            <tr>
                                <th>剩余内存</th>
                                <td>[[${system.mem.free}]]G</td>
                                <td>[[${system.jvm.free}]]M</td>
                            </tr>
                            <tr>
                                <th>使用率</th>
                                <td>[[${system.mem.usage}]]%</td>
                                <td>[[${system.jvm.usage}]]%</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">服务器信息</div>
                    <div class="layui-card-body ">
                        <table class="layui-table">
                            <tbody>
                            <tr>
                                <th>服务器名称</th>
                                <td>[[${system.sys.computerName}]]</td>
                            </tr>
                            <tr>
                                <th>服务器IP</th>
                                <td>[[${system.sys.computerIp}]]</td>
                            </tr>
                            <tr>
                                <th>操作系统</th>
                                <td>[[${system.sys.osName}]]</td>
                            </tr>
                            <tr>
                                <th>系统架构</th>
                                <td>[[${system.sys.osArch}]]</td>
                            </tr>
                            <tr>
                                <th>服务地址</th>
                                <td>https://gitee.com/hanshg/cherry</td>
                            </tr>
                            <tr>
                                <th>官网地址</th>
                                <td>http://www.cherryok.cn</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">Java虚拟机信息</div>
                    <div class="layui-card-body ">
                        <table class="layui-table">
                            <tbody>
                            <tr>
                                <th>Java名称</th>
                                <td>[[${system.jvm.name}]]</td>
                            </tr>
                            <tr>
                                <th>Java版本</th>
                                <td>[[${system.jvm.version}]]</td>
                            </tr>
                            <tr>
                                <th>启动时间</th>
                                <td>[[${system.jvm.startTime}]]</td>
                            </tr>
                            <tr>
                                <th>运行时长</th>
                                <td th:text="${system.jvm.runTime}"></td>
                            </tr>
                            <tr>
                                <th>安装路径</th>
                                <td th:text="${system.jvm.home}"></td>
                            </tr>
                            <tr>
                                <th>项目路径</th>
                                <td th:text="${system.sys.userDir}"></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">磁盘状态</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>盘符路径</th>
                            <th>文件系统</th>
                            <th>盘符类型</th>
                            <th>总大小</th>
                            <th>可用大小</th>
                            <th>已用大小</th>
                            <th>使用率</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="file:${system.sysDisks}">
                            <td th:text="${file.dirName}"></td>
                            <td th:text="${file.typeName}"></td>
                            <td th:text="${file.sysTypeName}"></td>
                            <td th:text="${file.total}"></td>
                            <td th:text="${file.free}"></td>
                            <td th:text="${file.used}"></td>
                            <td>[[${file.usage}]]%</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">开发团队</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <th>版权所有</th>
                            <td> Cherry柠檬水 </td>
                        </tr>
                        <tr>
                            <th>开发者</th>
                            <td> 韩寿阁(hanshouge@163.com) </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <style id="welcome_style"></style>
        <div class="layui-col-md12">
            <blockquote class="layui-elem-quote layui-quote-nm" style="text-align: center;">
                ©&nbsp2020-2021&nbspCherry柠檬水&nbsp版权所有&nbspICP证：<a href="https://beian.miit.gov.cn/" target="_blank">京ICP备20011719号-1</a>
            </blockquote>
        </div>
    </div>
</div>
<script>
    layui.use(['table', 'form'], function () {
        var table = layui.table;

        //显示用户名
        var nickName = localStorage.nickName;
        if (nickName != null && nickName != undefined) {
            nickName = nickName + "  ";
        } else {
            nickName = '----'
        }
        $("#show-nickName").text(nickName);

        $("#show_date").text("登录时间：" + dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss"));

        var dataCount = $("#dataCount");
        dataCount.html("");
        $.ajax({
            type: 'GET',
            url: '/sys/sysData',
            success: function (data) {
                var li = "";
                for (var i = 0; i < data.length; i++) {
                    li += "<li class='layui-col-md2 layui-col-xs6'>";
                    li += "<a href='javascript:;' class='x-admin-backlog-body'><h3>" + data[i].name + "</h3><p><cite>" + data[i].num + "</cite></p></a></li>";
                }
                dataCount.append(li);
            }
        });
        checkPermission();
    });
</script>
</body>
</html>